<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>代理商订票</title>
    </head>
    <body>
        <div id="booking_tickets">
        </div>
        <script>
            var paramStr = "airNo=<%=@airNo%>&fromto=<%=@fromto%>&fly_date=<%=@fly_date%>&position=<%=@position%>&fly_time=<%=@fly_time%>&arr_time=<%=@arr_time%>&plane_type=<%=@plane_type%>&price=<%=@price%> ";
            var flightInfoStr = "<%=@airNo %> <%=@fly_date %> <%=@position %>舱 <%=@from_city %> <%=@fly_time %> <%=@to_city %> <%=@arr_time %> <%=@plane_type %> <%=@price %>.00 元";
            var today = new Date().format('Y-m-d');
            var SEND_START_TIME = "<%=Constants::SEND_START_TIME%>";
            var SEND_END_TIME = "<%=Constants::SEND_END_TIME%>";
            var JJ_START_TIME = "<%=Constants::JJ_START_TIME%>";
            var JJ_END_TIME = "<%=Constants::JJ_END_TIME%>";

            Ext.onReady(function(){
                var currentSeatNumber = 1;

                var customerNameTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{name} {phone}</h3>', '</div></tpl>');
                var customerNameStore = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({
                        url: "/customers/getCustomersLikeName"
                    }),
                    reader: new Ext.data.JsonReader({
                        root: 'root'
                    }, [{
                            name: 'id'
                        }, {
                            name: 'name'
                        }, {
                            name: 'phone'
                        }])
                });
                var orderRequest = new Ext.form.TextField({
                    fieldLabel: '客户要求',
                    name: 'order_request',
                    anchor: '90%'
                });
                var flightInfo = new Ext.form.TextField({
                    fieldLabel: '航班信息',
                    name: 'flight_info',
                    anchor: '90%',
                    readOnly: true,
                    value: flightInfoStr
                });
                var linkMan = new Ext.form.TextField({
                    fieldLabel: '联系人',
                    name: 'link_man',
                    allowBlank: false,
                    blankText: '联系人必须填写',
                    anchor: '90%'
                });
                var linkPhone = new Ext.form.TextField({
                    fieldLabel: '联系电话',
                    name: 'link_tel',
                    allowBlank: false,
                    blankText: '联系电话必须填写',
                    anchor: '90%'
                });
                var linkAddress = new Ext.form.TextField({
                    fieldLabel: '地址',
                    name: 'link_address',
                    allowBlank: true,
                    blankText: '地址必须填写',
                    anchor: '90%'
                });
                var linkEmail = new Ext.form.TextField({
                    fieldLabel: '邮件',
                    name: 'link_email',
                    allowBlank: true,
                    blankText: '邮件必须填写',
                    anchor: '90%'
                });

                var seatStore = new Ext.data.Store({
                    reader: new Ext.data.ArrayReader({}, ['value']),
                    data: [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]
                });
                var seatNumber = new Ext.form.ComboBox({
                    name: 'seat_number',
                    fieldLabel: '座位数',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'value',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 1,
                    store: seatStore //数据储存到这个comboBox
                });
                function seatSelect(){
                    var selectedSeatNumber = parseInt(seatNumber.getValue());
                    //Ext.MessageBox.alert('提示', selectedSeatNumber+"/"+currentSeatNumber);
                    //Ext.MessageBox.alert('提示', 'div_passenger_'+currentSeatNumber);
                    //ageType2.render();
                    if (selectedSeatNumber > currentSeatNumber) {
                        for (i = currentSeatNumber + 1; i <= selectedSeatNumber; i++) {
                            //Ext.MessageBox.alert('提示', i);
                            Ext.getCmp('div_passenger_' + i).show();
                            eval('passengerName' + i + '.allowBlank=false');
                            if (eval('ageType' + i).getValue() != "成人") {
                                eval('birthday' + i + '.allowBlank=false');
                            }
                        }
                    }
                    else {
                        for (i = selectedSeatNumber + 1; i <= currentSeatNumber; i++) {
                            //Ext.MessageBox.alert('提示', i);
                            Ext.getCmp('div_passenger_' + i).hide();
                            eval('birthday' + i + '.allowBlank=true');
                            eval('passengerName' + i + '.allowBlank=true');
                            
                        }
                    }
                    currentSeatNumber = selectedSeatNumber;
                }
                seatNumber.on('select', seatSelect);

                //常旅客关键字搜索
                var pass_resultTpl = new Ext.XTemplate('<tpl for="."><div class="search-item">', '<h3>{name} {card}</h3>', '</div></tpl>');
                var pass_nameStore = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({
                        url: "/customers/getPassengerComboBox"
                    }),
                    reader: new Ext.data.JsonReader({
                        root: 'root'
                    }, [{
                            name: 'name'
                        }, {
                            name: 'phone'
                        }, {
                            name: 'card'
                        }])
                });
                var passengerName1 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_1',
                    allowBlank: false,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName1.setValue(record.data.name);
                        card1.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card1 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_1',
                    anchor: '90%'
                });
                var birthday1 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_1',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageTypeArray = [['成人', '成人'],['教师', '教师'],['学生', '学生'], ['儿童', '儿童'], ['婴儿', '婴儿']];
                var ageTypeReader = new Ext.data.ArrayReader({
                    id: 0
                }, [{
                        name: 'key'
                    }, {
                        name: 'value'
                    }]);
                var ageTypeStore = new Ext.data.Store({
                    reader: ageTypeReader
                });
                ageTypeStore.loadData(ageTypeArray);
                var ageType1 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_1',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100,
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday1.disable();
                                birthday1.allowBlank = true;
                                card1.enable();
                            }
                            else {
                                birthday1.enable();
                                birthday1.allowBlank = false;
                                card1.setValue('');
                                card1.disable();
                            }
                        }
                    }
                });
                var insuranceArray = [['0', '0'], ['1', '1'], ['2', '2']];
                var insuranceReader = new Ext.data.ArrayReader({
                    id: 0
                }, [{
                        name: 'value'
                    }, {
                        name: 'key'
                    }]);
                var insuranceStore = new Ext.data.Store({
                    reader: insuranceReader
                });
                insuranceStore.loadData(insuranceArray);
                var insurance1 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_1',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //2
                var passengerName2 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_2',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName2.setValue(record.data.name);
                        card2.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card2 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_2',
                    anchor: '90%'
                });
                var birthday2 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_2',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType2 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_2',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday2.disable();
                                birthday2.allowBlank = true;
                                card2.enable();
                            }
                            else {
                                birthday2.enable();
                                birthday2.allowBlank = false;
                                card2.setValue('');
                                card2.disable();
                            }
                        }
                    }
                });
                var insurance2 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_2',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //3
                var passengerName3 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_3',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName3.setValue(record.data.name);
                        card3.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card3 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_3',
                    anchor: '90%'
                });
                var birthday3 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_3',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType3 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_3',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday3.disable();
                                birthday3.allowBlank = true;
                                card3.enable();
                            }
                            else {
                                birthday3.enable();
                                birthday3.allowBlank = false;
                                card3.setValue('');
                                card3.disable();
                            }
                        }
                    }
                });
                var insurance3 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_3',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //4
                var passengerName4 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_4',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName4.setValue(record.data.name);
                        card4.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card4 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_4',
                    anchor: '90%'
                });
                var birthday4 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_4',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType4 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_4',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday4.disable();
                                birthday4.allowBlank = true;
                                card4.enable();
                            }
                            else {
                                birthday4.enable();
                                birthday4.allowBlank = false;
                                card4.setValue('');
                                card4.disable();
                            }
                        }
                    }
                });
                var insurance4 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_4',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //5
                var passengerName5 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_5',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName5.setValue(record.data.name);
                        card5.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card5 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_5',
                    anchor: '90%'
                });
                var birthday5 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_5',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType5 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_5',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday5.disable();
                                birthday5.allowBlank = true;
                                card5.enable();
                            }
                            else {
                                birthday5.enable();
                                birthday5.allowBlank = false;
                                card5.setValue('');
                                card5.disable();
                            }
                        }
                    }
                });
                var insurance5 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_5',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //6
                var passengerName6 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_6',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName6.setValue(record.data.name);
                        card6.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card6 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_6',
                    anchor: '90%'
                });
                var birthday6 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_6',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType6 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_6',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday6.disable();
                                birthday6.allowBlank = true;
                                card6.enable();
                            }
                            else {
                                birthday6.enable();
                                birthday6.allowBlank = false;
                                card6.setValue('');
                                card6.disable();
                            }
                        }
                    }
                });
                var insurance6 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_6',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //7
                var passengerName7 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_7',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName7.setValue(record.data.name);
                        card7.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card7 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_7',
                    anchor: '90%'
                });
                var birthday7 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_7',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType7 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_7',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday7.disable();
                                birthday7.allowBlank = true;
                                card7.enable();
                            }
                            else {
                                birthday7.enable();
                                birthday7.allowBlank = false;
                                card7.setValue('');
                                card7.disable();
                            }
                        }
                    }
                });
                var insurance7 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_7',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });

                //8
                var passengerName8 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_8',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName8.setValue(record.data.name);
                        card8.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card8 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_8',
                    anchor: '90%'
                });
                var birthday8 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_8',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType8 = new Ext.form.ComboBox({ //combobox
                    name: 'age_type_8',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday8.disable();
                                birthday8.allowBlank = true;
                                card8.enable();
                            }
                            else {
                                birthday8.enable();
                                birthday8.allowBlank = false;
                                card8.setValue('');
                                card8.disable();
                            }
                        }
                    }
                });
                var insurance8 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_8',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });
                //9
                var passengerName9 = new Ext.form.ComboBox({
                    store: pass_nameStore,
                    fieldLabel: '乘客',
                    name: 'pessenger_name_9',
                    allowBlank: true,
                    blankText: "乘客姓名不允许为空",
                    //displayField: 'name',
                    typeAhead: false,
                    loadingText: '正在查找...',
                    //width: 230,
                    anchor: '90%',
                    //hideTrigger: true,
                    tpl: pass_resultTpl,
                    minChars: 0,
                    itemSelector: 'div.search-item',
                    onSelect: function(record){
                        passengerName9.setValue(record.data.name);
                        card9.setValue(record.data.card);
                        if (this.isExpanded()) {
                            this.collapse();
                        }
                    }
                });
                var card9 = new Ext.form.TextField({
                    fieldLabel: '证件号码',
                    name: 'card_9',
                    anchor: '90%'
                });
                var birthday9 = new Ext.form.DateField({
                    fieldLabel: '生日',
                    name: 'birthday_9',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: true,
                    blankText: "出生日期必须选择",
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //anchor: '50%'
                    width: 90
                });
                var ageType9 = new Ext.form.ComboBox({
                    name: 'age_type_9',
                    fieldLabel: '类型',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: "成人",
                    store: ageTypeStore,
                    listeners: {
                        select: function(combo, record, index){
                            if (record.data.value == "成人" || record.data.value == "教师" || record.data.value == "学生") {
                                birthday9.disable();
                                birthday9.allowBlank = true;
                                card9.enable();
                            }
                            else {
                                birthday9.enable();
                                birthday9.allowBlank = false;
                                card9.setValue('');
                                card9.disable();
                            }
                        }
                    }
                });
                var insurance9 = new Ext.form.ComboBox({ //combobox
                    name: 'insurance_9',
                    fieldLabel: '保险',
                    resiable: true,
                    typeAhead: true,
                    handleHeight: 100, //
                    displayField: 'key',
                    valueField: 'value',
                    selectOnFocus: true,
                    mode: 'local',
                    width: 60,
                    triggerAction: 'all',//这个属性非常重要,可以在选择一个值以后,依然还显示其它的值.
                    readOnly: true,
                    value: 0,
                    store: insuranceStore
                });

                var submitButton = new Ext.Button({
                    text: ' 提 交 ',
                    handler: function(){
                        if (bookingTicketsFormPanel.form.isValid()) {
                            submitButton.setDisabled(true);
                            bookingTicketsFormPanel.form.submit({
                                waitMsg: '正在提交中......',
                                success: function(form, action){
                                    var info = "";
                                    if (action && action.result) {
                                        info = action.result.info;
                                    }
                                    else {
                                        info = '订票失败,具体失败原因请查询日志文件';
                                    }
                                    if (info.indexOf("成功") >= 0) {
                                        Ext.MessageBox.alert('订票成功', info);
                                    }
                                    else {
                                        Ext.MessageBox.alert('操作信息', info);
                                        submitButton.setDisabled(false);
                                    }
                                },
                                failure: function(form, action){
                                    Ext.MessageBox.alert('操作失败', '订票失败');
                                    submitButton.setDisabled(false);
                                }
                            });
                        }else{
                            Ext.MessageBox.alert('提示', '请填写必填信息后再提交');
                        }
                    }
                })
                var bookingTicketsFormPanel = new Ext.form.FormPanel({
                    //baseCls: 'x-plain',
                    labelWidth: 55,
                    labelAlign: 'right',
                    frame: true,
                    width: '100%',
                    url: '/ticket/save_order?' + paramStr,
                    //params: paramStr,
                    //defaultType: 'textfield',
                    items: [flightInfo,{
                            layout: 'column',
                            border: false,
                            items: [{
                                    columnWidth: .25,
                                    layout: 'form',
                                    border: false,
                                    items: [linkMan]
                                }, {
                                    columnWidth: .25,
                                    layout: 'form',
                                    border: false,
                                    items: [linkPhone]
                                }, {
                                    columnWidth: .5,
                                    layout: 'form',
                                    border: false,
                                    items: [linkAddress]
                                }]
                        }, {
                            layout: 'column',
                            border: false,
                            items: [{
                                    columnWidth: .2,
                                    layout: 'form',
                                    border: false,
                                    items: [seatNumber]
                                }, {
                                    columnWidth: .3,
                                    layout: 'form',
                                    border: false,
                                    items: [linkEmail]
                                }, {
                                    columnWidth: .5,
                                    layout: 'form',
                                    border: false,
                                    items: [orderRequest]
                                }]
                        }, {
                            id: 'div_passenger',
                            xtype: 'fieldset',
                            title: '常旅客信息',
                            collapsible: true,
                            autoHeight: true,
                            items: [{
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_1',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName1]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card1]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType1]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday1]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance1]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_2',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName2]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card2]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType2]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday2]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance2]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_3',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName3]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card3]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType3]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday3]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance3]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_4',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName4]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card4]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType4]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday4]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance4]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_5',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName5]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card5]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType5]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday5]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance5]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_6',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName6]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card6]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType6]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday6]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance6]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_7',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName7]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card7]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType7]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday7]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance7]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_8',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName8]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card8]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType8]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday8]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance8]
                                        }]
                                }, {
                                    layout: 'column',
                                    border: false,
                                    id: 'div_passenger_9',
                                    items: [{
                                            columnWidth: .23,
                                            layout: 'form',
                                            border: false,
                                            items: [passengerName9]
                                        }, {
                                            columnWidth: .27,
                                            layout: 'form',
                                            border: false,
                                            items: [card9]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [ageType9]
                                        }, {
                                            columnWidth: .2,
                                            layout: 'form',
                                            border: false,
                                            items: [birthday9]
                                        }, {
                                            columnWidth: .15,
                                            layout: 'form',
                                            border: false,
                                            items: [insurance9]
                                        }]
                                }]
                        }],
                    buttons: [submitButton]
                });

                //隐藏座位
                function hideSeat(){
                    for (i = 2; i < 10; i++) {
                        //Ext.MessageBox.alert('提示', 'div_passenger_'+i.toString());
                        Ext.getCmp('div_passenger_' + i).hide();
                    }
                }
                //hideSeat();
                birthday1.disable();
                birthday2.disable();
                birthday3.disable();
                birthday4.disable();
                birthday5.disable();
                birthday6.disable();
                birthday7.disable();
                birthday8.disable();
                birthday9.disable();

                bookingTicketsFormPanel.render('booking_tickets');
                hideSeat();

            })



        </script>
    </body>
</html>
